package cn.dengta.webapp.ai.entity;

import java.util.Date;

import cn.dengta.context.model.WesKit;
import cn.dengta.webapp.base.entity.TimeBasedEntity;
import cn.dengta.webapp.im.enums.ChatType;
import lombok.Getter;
import lombok.Setter;
import me.codeplayer.util.Cmp;
import me.codeplayer.util.X;

/**
 * Ai速配日志
 *
 * @author zxy
 * @since 2024-04-23
 */
@Setter
@Getter
public class AiSpeedLog extends TimeBasedEntity {

	private static final long serialVersionUID = 1L;
	/** 分包 */
	WesKit wesKit;
	/** 发起速配的用户 */
	Long userId;
	/** 速配到的Ai标识 */
	Long aiId;
	/** Ai所属用户ID */
	Long aiUserId;
	/** 速配类型：1=聊天；2=语音 */
	Integer type;
	/** 通话时长（单位：秒） */
	Integer duration;
	/** 状态：-1=已拒绝；0=未接受；1=通话中；2=已完成 */
	Integer status;
	/** 接受时间 */
	Date acceptTime;

	public static AiSpeedLog init(Long userId, Long aiId, Long aiUserId, ChatType type, Integer status) {
		AiSpeedLog asl = new AiSpeedLog();
		asl.userId = userId;
		asl.aiId = aiId;
		asl.aiUserId = aiUserId;
		asl.type = type.value;
		asl.status = X.expectNotNull(status, 1);
		asl.initTime(new Date());
		return asl;
	}

	public static final String USER_ID = "user_id";
	public static final String AI_ID = "ai_id";
	public static final String AI_USER_ID = "ai_user_id";
	public static final String TYPE = "type";
	public static final String DURATION = "duration";
	public static final String STATUS = "status";
	public static final String ACCEPT_TIME = "accept_time";
	public static final String ADD_TIME = "add_time";
	public static final String UPDATE_TIME = "update_time";

}
